package com.dapeng.jackson.annotations;

import com.dapeng.jackson.serializer.JKDecimalScaleSerializer;
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @BelongProject study
 * @BelongPackage com.dapeng.jackson.annotations
 * @Description TODO
 * @ClassName JKDecimalFormat
 * @Author xupenghong
 * @Date 2024/9/13 16:00
 * @Version 1.0.0
 */
@Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@JsonSerialize(using = JKDecimalScaleSerializer.class)
@JacksonAnnotationsInside
public @interface JKDecimalFormat {

    /**
     * 保留精度
     */
    int scale() default 2;

    /**
     * 智能保留精度
     */
    boolean smartScale() default true;
}
